<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get pool size for connection pools</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongopool.html">MongoPool</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongopool.info.html">MongoPool::info</a></div>
 <div class="up"><a href="class.mongopool.html">MongoPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongopool.getsize" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoPool::getSize</h1>
  <p class="verinfo">(PECL mongo &gt;= 1.2.3)</p><p class="refpurpose"><span class="refname">MongoPool::getSize</span> &mdash; <span class="dc-title">Get pool size for connection pools</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongopool.getsize-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">int</span> <span class="methodname"><strong>MongoPool::getSize</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongopool.getsize-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongopool.getsize-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the current pool size.
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-mongopool.getsize-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>1.2.11</td>
       <td>Emits <strong><code>E_DEPRECATED</code></strong> when used.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongopool.getsize-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1482">
   <p><strong>Example #1 Changing pool size</strong></p>
   <div class="example-contents"><p>
    This returns the default pool size, sets a new pool size, then prints the
    new pool size and the pool debugging information.  Note that changing the
    pool size only affects new connection pools, it does not change old ones.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$connection&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">(</span><span style="color: #DD0000">"host1"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;pool&nbsp;size&nbsp;is&nbsp;-1<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"pool&nbsp;size&nbsp;is:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />echo&nbsp;</span><span style="color: #DD0000">"setting&nbsp;pool&nbsp;size&nbsp;to&nbsp;200\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(</span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;pool&nbsp;size&nbsp;is&nbsp;200<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"pool&nbsp;size&nbsp;is:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$conn2&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">(</span><span style="color: #DD0000">"host2"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;remaining&nbsp;for&nbsp;host1&nbsp;is&nbsp;-2<br />//&nbsp;remaining&nbsp;for&nbsp;host2&nbsp;is&nbsp;199<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">::</span><span style="color: #0000BB">poolDebug</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongopool.getsize-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mongopool.setsize.html" class="function" rel="rdfs-seeAlso">MongoPool::setSize()</a> - Set the size for future connection pools.</span></li>
    <li class="member"><span class="function"><a href="mongopool.info.html" class="function" rel="rdfs-seeAlso">MongoPool::info()</a> - Returns information about all connection pools.</span></li>
    <li class="member">The <a href="mongo.connecting.html" class="link">connection</a> documentation.</li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongopool.html">MongoPool</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongopool.info.html">MongoPool::info</a></div>
 <div class="up"><a href="class.mongopool.html">MongoPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
